import axios from 'poros/http';

// const BASE_API = 'http://10.110.96.192:8030';
const BASE_API = '';

//跟进事项分页查
export const postMatterList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/matter/listByPage`,
    method: 'post',
    data,
  });

//导出事项列表
export const postDownMatterlist = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/matter/listExportTemplate`,
    method: 'post',
    responseType: 'arraybuffer',
    hasInterceptors: true,
    data,
  });

//跟进事项详情
export const getMatterInfo = id =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/matter/query/${id}`,
    method: 'get',
  });

//上传附件
export const postUpAttachment = (file, type, id) => {
  const formData = new FormData();
  formData.append('file', file);
  return axios({
    url: `${BASE_API}/api/salesforecast-service/attachment/upload/${type}/matter${id}`,
    headers: { 'Content-Type': 'nultipart/form-data' },
    method: 'post',
    data: formData,
  });
};

//保存或提交跟进事项
export const postSaveMatter = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/matter/submitDeal`,
    method: 'post',
    data,
  });

//跟进事项转他人处理
export const postRetweet = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/matter/forward`,
    method: 'post',
    data,
  });
